1. Field of the Invention
This invention relates in general to the field of microprocessors, and more particularly to a method and apparatus for converting and transferring data between floating point and integer registers without first storing the data in memory.
2. Description of the Related Art
One of the fundamental applications of a computer system is the processing and storing of numeric data (sometimes called xe2x80x9cnumber crunchingxe2x80x9d). To more efficiently perform digital operations on numeric data, scientists and engineers have adopted numerical structures that differ from those used in traditional mathematics. First of all, to perform arithmetic operations, a computer must be capable of storing and retrieving numerical data. The numerical data should ideally be stored in consistent formats designed to minimize space and optimize processing efficiency. Historically, numeric data was stored in structures devised to fit the characteristics of a specific machine. Only recently have common standards been adopted that define mathematical standards for digital computers.
In general, modern computer systems treat numerical data as either integer data or floating point data depending on the application, the size of the number required by the application, and the type of operation to be performed on the data. Because of the difference in data formats between integer data and floating point data, microprocessors typically have two separate processing units, one for processing integer data (the Integer Unit, or IU), the other for processing floating point data (the Floating Point Unit, or FPU). Integer data is operated on by the integer unit within a microprocessor, while floating point data is operated on by the floating point unit within a microprocessor.
Frequently, data is shared by both an integer unit and a floating point unit. When data is shared, it must first be converted into an acceptable form, depending on whether it will be operated upon by the integer unit or the floating point unit. Conversion of data into an acceptable form is typically accomplished as a single operation that converts the data, from integer to floating point, or from floating point to integer, and then stores the converted data into memory.
Thus, before an integer unit can operate on data that is in a floating point unit, the data must first be converted into integer format, and then stored to memory. Alternatively, before a floating point unit can operate on data that is in an integer unit, the data must first be converted into floating point format, and then stored to memory. In modern microprocessors, requiring data to be converted, stored to memory, and then retrieved from memory, is very time consuming for the microprocessor, and adds significant delay in processing the data.
Therefore, what is needed is an apparatus and method that converts numerical data into an acceptable format for either an integer unit, or a floating point unit, without requiring the data to be stored to, and later retrieved from memory. Furthermore, what is needed is a microprocessor that shares data between an integer unit and a floating point unit, and separates the steps of format conversion and data movement.
To address the above-detailed deficiencies, it is an object of the present invention to provide a method and apparatus for bi-directional transfer of data between a floating point unit and an integer unit, without requiring intermediate storage in system memory.
Accordingly, in the attainment of the aforementioned object, it is a feature of the present invention to provide a microprocessor that includes an integer register file, a floating point register file, and a first conversion instruction. The integer register file is configured to store a plurality of integers. The floating point register file is coupled to the integer register file and is configured to store a plurality of floating point numbers. The floating point register file is also configured to store data in integer format. The first conversion instruction is provided by a translator, or by a control ROM. The first conversion instruction converts a first one of the plurality of floating point numbers within the floating point register file into a first integer and temporarily stores the first integer within the floating point register file.
An advantage of the present invention is that data may be transferred between the integer register file and the floating point register file much faster than the prior art, since the microprocessor does not have to store the converted data in system memory.
Another object of the present invention is to provide a floating point register file that can store either floating point data or integer data.
It is therefore a feature of the present invention to provide a floating point register file within a microprocessor. The floating point register file includes a plurality of floating point registers, and conversion logic. The plurality of floating point registers store floating point numbers in extended precision format. The conversion logic is coupled to the plurality of floating point registers and is configured to convert the floating point numbers into integers, and to store the integers into the plurality of floating point registers. Once the conversion is complete, the integer data can be moved to the integer register file.
An advantage of the present invention is that by allowing the floating point register file to store both floating point data, and integer data, the conversion process can be separated into two distinct steps of converting the data, and moving the data.
It is therefore an object of the present invention to separate data interchange between the floating point register and the integer register into two distinct steps: converting the data, and moving the data.
Another feature of the present invention is to provide a method for transferring data between an integer register file and a floating point register file that does not require intermediate storage of the data in system memory. One method includes retrieving integer data from an integer register file and storing the integer data into a floating point register file. This method further includes converting the stored integer data in the floating point register file into floating point data.
An alternative method includes converting floating point data in a floating point register file into integer data, retrieving the integer data from the floating point register file and storing the integer data into an integer register file. Depending on which method is used, data can either begin as integer data in the integer register, and can be moved to the floating point register and converted. Or, data can begin as floating point data in the floating point register, and can be converted and moved to the integer register.
An advantage of this invention is that data conversion and movement between an integer unit and a floating point unit can be rapidly performed without requiring intermediate storage in system memory.
A further advantage of the present invention is that since the steps of conversion and movement are distinct, other instructions may be placed between the steps of conversion and movement, to eliminate dependency stalls in the pipeline of a microprocessor.